using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace jSLCore.Service.Workflow.Linq.jProperty
{
    public class jPropertyQueryable<T> : IQueryable, IQueryable<T>,IEnumerable<T>,IEnumerable
    {
        private readonly IQueryable<T> _queryable;
        private readonly IQueryProvider _jPropertyProvider;
        public jPropertyQueryable(IQueryable<T> queryable)
        {
            _queryable = queryable;
            _jPropertyProvider = new jPropertyProvider(queryable.Provider);
        }

        public IEnumerator<T> GetEnumerator()
        {
            return _queryable.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public Expression Expression
        {
            get { return _queryable.Expression; }
        }

        public Type ElementType
        {
            get { return typeof (T); }
        }

        public IQueryProvider Provider
        {
            get { return _jPropertyProvider; }
        }
    }
}